<template>
  <div id="app">
    <router-view class="main" />
    <van-tabbar
      :fixed="false"
      route
      active-color="yellowgreen"
      v-show="isShowNav"
    >
      <!-- active-color="deeppink" 改变选中的颜色 -->
      <van-tabbar-item icon="home-o" :to="{ name: 'Home' }"
        >首页</van-tabbar-item
      >
      <van-tabbar-item icon="qr-invalid" :to="{ name: 'List' }" dot
        >列表</van-tabbar-item
      >
      <!-- <van-tabbar-item icon="fire-o" :to="{ name: 'Community' }" dot
        >社区</van-tabbar-item
      > -->
      <van-tabbar-item icon="cart-o" badge="5" :to="{ name: 'Cart' }"
        >购物车</van-tabbar-item
      >
      <van-tabbar-item icon="user-circle-o" :to="{ name: 'User' }"
        >我的</van-tabbar-item
      >
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isShowNav: true,
    };
  },
  // watch 监听路由属性
  watch: {
    $route(v) {
      if (v.meta.hideNav) {
        this.isShowNav = false;
      } else {
        this.isShowNav = true;
      }
    },
  },
};
</script>

<style lang="scss">
html,
body,
#app {
  width: 100%;
  height: 100%;
} 
img {
  max-width: 100%;
}
#app {
  display: flex;
  flex-direction: column;
}
.main {
  flex: 1;
  overflow: auto;
}
</style>
